package com.github.llyb120.yaomq.server;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import javax.annotation.Resource;

@Configuration
public class WebSocketConfig {
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

    public static String authToken;
    public static String port;

    @Autowired
    public void init(
        @Value("${yaomq.token}") String authToken,
        @Value("${server.port}") String port
    ){
        WebSocketConfig.authToken = authToken;
        WebSocketConfig.port = port;
    }

}
